﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Collections;
using System.Configuration;
using System.Text.RegularExpressions;
namespace gamexpert
{
    public class Product: IComparable<Product>
    {
        int _id;
        string _title;
        double _price;
        double _shippingcost;
        int _qty;
        public Product()
        {
            init();
        }
        public Product(int id,string title,double price,double shippingcost,int qty)
        {
            init();
            _id = id;
            _title = title;
            _price = price;
            _shippingcost = shippingcost;
            _qty = qty;
        }
        public Product(int id, int qty)
        {
            init();
            _id = id;
            _qty = qty;
        }
        void init()
        {
            _id = 0;
            _title = "";
            _price = 0.0;
            _shippingcost = 0.0;
            _qty = 0;
        }
        public int Id
        {
            get { return _id; }
            set { _id = value; }
        } 
        public string Title
        {
            get { return _title; }
            set { _title = value; }
        }
        public double Price
        {
            get { return _price; }
            set { _price = value; }
        }
        public double ShippingCost
        {
            get { return _shippingcost; }
            set { _shippingcost = value; }
        }
        public int Qty
        {
            get { return _qty; }
            set { _qty = value; }
        }
        public double Total()
        {
            return ((_price*_qty)+(_shippingcost*_qty));
        }
        public double TotalShippingCost()
        {
            return (_shippingcost * _qty);
        }
        public int CompareTo(Product p)
        {
            int i = 0;
            if (this._id == p.Id)
            {
                i = 0;
            }
            else if (this._id < p.Id)
            {
                i = -1;
            }
            else
            {
                i = 1;
            }
            return i;
        }
    }
}